package com.guijianpan.system.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.guijianpan.system.domain.User;
import com.guijianpan.system.repository.UserRepository;

@Service
public class UserService {
	
	@Autowired
	private UserRepository userRepository;

	@Transactional
	public User save(User User) {
		return userRepository.save(User);
	}

	public List<User> findAll() {
		return (List<User>) userRepository.findAll();
	}

	public User findOne(Long id) {
		return userRepository.findOne(id);
	}
	
	public User findByNameAndPwd(String name, String pwd) {
		return userRepository.findByNameAndPwd(name, pwd);
	}

}
